<?php

namespace App\Http\Middleware;

use Closure;
use Illuminate\Support\Facades\Auth;

class RoleApi
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request $request
     * @param  \Closure                 $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $user = Auth::user ();
        //检查角色权限内容
        if ($user->id == '') {
            return response ()->json (['error' => ['msg' => '角色没有操作权限']]);
        }

        return $next($request);
    }
}
